import 'package:flutter/material.dart';
import 'package:jm_flutter/jm_flutter.dart';

import '../routers/routes.dart';

class InitPage extends StatefulWidget {
  const InitPage({Key? key}) : super(key: key);

  @override
  _InitPageState createState() => _InitPageState();
}

class _InitPageState extends State<InitPage> {
  final tag = "InitPage";

  init() async {
    delay(1000, () {
      gotoNamedAndOffAll(Pages.home);
    });
  }

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    delay(1000, () {
      // if (isFirstUse &&
      //     !G_googlePlay &&
      //     Platform.isAndroid &&
      //     I18n.isSystemCn) {
      //   Get.dialog(
      //     PrivacyStatementDialog(onAgree: () {
      //       setFirstUse();
      //       init();
      //     }),
      //   );
      // } else {
      init();
      //}
    });
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MySystemUI(
      child: Scaffold(
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ZoomIn(
              child: Container(
                alignment: Alignment.center,
                //padding: const EdgeInsets.only(bottom: 40),
                child: const SizedBox(
                    height: 140, child: MyImage("assets/img/logo.png")),
              ),
            ),
            gapv16,
            FadeIn(child: MyText("-- Jm Flutter --"))
          ],
        ),
      ),
    );
  }
}
